package com.hc.fdkgoods.dao;

import org.jooq.impl.DSL;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;

import static com.hc.fdkgoods.db.tables.SellerOnPrepareSkuList.SELLER_ON_PREPARE_SKU_LIST;

@Repository
public class PrepareSkuTagDao extends BaseDao {
    public void update(Long skuId) {
        db.update(SELLER_ON_PREPARE_SKU_LIST)
                .set(SELLER_ON_PREPARE_SKU_LIST.PREPARE_NUM,
                        SELLER_ON_PREPARE_SKU_LIST.PREPARE_NUM.subtract(new BigDecimal(1)))
                .where(SELLER_ON_PREPARE_SKU_LIST.SELLER_SKU_ID.eq(skuId), SELLER_ON_PREPARE_SKU_LIST.MERCHANT_ID.eq(1L)).execute();
    }
}
